#pragma once

#include <memory>
#include "ObjectFactory.h"
#include "Action.h"
#include "typedefs.h"

class Machine;

class ActionFactory
{
public:
    ActionFactory(Machine* machine);

public:
    ActionPtr MakeAction(const QString& type, const StringMap& properties);

private:
    const QByteArray GetObjectValue(const QString& object);

private:
    Action* Reset();
    Action* Send();
    Action* Addchar();
    Action* Timeout();
    Action* Log();

    //crc
    Action* XOR8bit();

private:
    typedef Action* (ActionFactory::*Func)();

    QMap<QString, Func> ptrType;
    ObjectFactory objectFactory;
    Machine* _machine;
};

typedef std::tr1::shared_ptr<ActionFactory> ActionFactoryPtr;